/*
 * @file
 * @date 18.05.2010
 * @author Ivan Babushkin (jogrms@gmail.com)
 */

#include <model.h>
#include <default.h>
#include <render.h>
#include <localtypes.h>
#include <time.h>
#include <pthread.h>
#include <stdio.h>

Model* model;

int main(int argc, char* argv[]) {
	pthread_t modelTID;
	int modelTArg;
	
	model = modelInit();
	renderInitGLX();
	renderSetupModel(model);

	pthread_create(&modelTID, NULL, modelThreadRoutine, &modelTArg);

	
	struct timespec frameDelay;
	frameDelay.tv_sec = 0;
	frameDelay.tv_nsec = model->params.frameDelay * 1000;
	while (processEvent()) {
			redraw();
			nanosleep(&frameDelay, NULL);
	}

	return 0;
}
